package com.tjetc._2function;

import java.util.Arrays;
import java.util.function.Supplier;

public class _1Supplier {
    public static void main(String[] args) {
        // ⽤Lambda表达式求出int数组中的最⼤值
        testSupplier(() -> {
            // 获取的逻辑
            int[] nums = {2, 1};
            Arrays.sort(nums);
            return nums[nums.length - 1];
        });
    }

    public static void testSupplier(Supplier<Integer> supplier) {
        Integer i = supplier.get();
        System.out.println(i);
    }
}
